import request from './request'
import {
  FileItem,
  ItemFileInfo,
  PageDto,
  ResponseDto,
  SaveItemFileInputDto,
  DeletetemInputDto,
  SaveItemInputDto,
  UpdateAllItemInputDto,
} from './types'
const rootUrl = '/html/'

export function GetDirectoryList() {
  return request<ResponseDto<FileItem[]>>({
    url: rootUrl + 'GetDirectoryList',
    method: 'get',
  })
}
export function GetItemFileInfo(uuid: string) {
  return request<ResponseDto<ItemFileInfo>>({
    url: `${rootUrl}GetItemFileInfo?uuid=${uuid}`,
    method: 'get',
  })
}
export function SaveItemFile(data: SaveItemFileInputDto) {
  return request<ResponseDto<string>>({
    url: `${rootUrl}SaveItemFile`,
    method: 'post',
    data: data,
  })
}
export function DeleteItemFile(uuid: string) {
  return request<ResponseDto<boolean>>({
    url: `${rootUrl}DeleteItemFile?uuid=${uuid}`,
    method: 'post',
  })
}
export function RestoreItemFile(uuid: string) {
  return request<ResponseDto<boolean>>({
    url: `${rootUrl}RestoreItemFile?uuid=${uuid}`,
    method: 'post',
  })
}
export function SaveItem(data: SaveItemInputDto) {
  return request<ResponseDto<boolean>>({
    url: `${rootUrl}SaveItem`,
    method: 'post',
    data: data,
  })
}
export function DeleteItem(data: DeletetemInputDto) {
  return request<ResponseDto<boolean>>({
    url: `${rootUrl}DeleteItem`,
    method: 'post',
    data: data,
  })
}
export function UpdateAllItem(data: UpdateAllItemInputDto) {
  return request<ResponseDto<boolean>>({
    url: `${rootUrl}UpdateAllItem`,
    method: 'post',
    data: data,
  })
}
